# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=libpfm4
pkgver=4.11.0
pkgrel=2
pkgdesc='Library to encode performance events for use by perf tool.'
arch=('x86_64' 'aarch64')
url='http://perfmon2.sourceforge.net/'
license=('MIT')
depends=('glibc')
source=("http://downloads.sourceforge.net/project/perfmon2/$pkgname/libpfm-$pkgver.tar.gz")
sha512sums=('633035b8a7b35973437572095cdc80d422b2a1a61e74e14f106db95fa8e44e4518e591699cc457f828b8f2fb63f60eef6d0c7535c6b4c9a6c3a70d4550b3c3c7')
conflicts=('libpfm3')

build() {
  cd "${pkgname//4/}-$pkgver"

  sed -i 's|PREFIX?=/usr/local|PREFIX?=/usr|g' config.mk
  sed -i 's|LDCONFIG=ldconfig|LDCONFIG=true|g' config.mk

  make
}

package() {
  cd "${pkgname//4/}-$pkgver"

  make DESTDIR="$pkgdir" install
  make DESTDIR="$pkgdir" install_examples
}

